﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;

using eSYSU.Data.DataAccess;
using eSYSU.Web.Entity;

namespace eSYSU.Web.Business
{
	/// <summary>
	/// eSYSU微博相关业务
	/// </summary>
	public class WeiboService
	{
		public WeiboService()
		{
			//
			//TODO: 在此处添加构造函数逻辑
			//
		}

		/// <summary>
		/// 微博绑定更新
		/// </summary>
		/// <param name="weibo">微博绑定对象</param>
		/// <returns>绑定结果</returns>
		public static bool WeiboBindingUpdate(WeiboBinding weibo)
		{
			if (weibo != null)
			{
				IDictionary<string, object> parmsDic = new Dictionary<string, object>();
				parmsDic.Add("@_UserId", weibo.userId);
				parmsDic.Add("@_Name", weibo.name);
				parmsDic.Add("@_Type", weibo.type);
				parmsDic.Add("@_WeiboUserId", weibo.weiboUserId);
				parmsDic.Add("@_ScreenName", weibo.screenName);
				parmsDic.Add("@_AccessToken", weibo.accessToken);
				parmsDic.Add("@_AccessSecret", weibo.accessSecret);

				if (eSYSU.Data.DataAccess.SqlHelper.ExecuteNonQuery(eSYSU.Data.DataAccess.SqlHelper.ConnString,
					CommandType.StoredProcedure, eSYSU.Web.Common.Constants.PROC_WEIBO_UPDATE, parmsDic) != -1)
					return true;
				else return false;
			}
			return false;
		}
	}
}